import axios from '~/axios'
import { joinPramas } from './manager'

// 工程师、客户

// 列表
export function api_user_list(getReqParams) {
    let url = '/api/backend/wxUser/list'
    let finalUrl = joinPramas(url, getReqParams)
    return axios.get(finalUrl)
}

// 新增
export function api_user_add(jsonData) {
    let url = '/api/backend/wxUser/add'
    return axios.post(url, jsonData)
}

// 更新
export function api_user_update(id, jsonData) {
    let url = '/api/backend/wxUser/edit'
    jsonData.id = id
    return axios.post(url, jsonData)
}

// 审核
export function api_user_audit(paramIo) {
    let url = '/api/backend/wxUser/audit'
    return axios.post(url, paramIo)
}


// 删除
export function api_user_delete(id) {
    let url = '/api/backend/wxUser/delete/' + id
    return axios.post(url, {})
}

export function api_user_list_customer(getReqParams) {
    let url = '/api/backend/wxUser/list'
    let finalUrl = joinPramas(url, getReqParams)
    return axios.get(finalUrl)
}

export function api_avatar_uploadFile(formData) {
    let url = '/api/backend/wxUser/uploadAvatarFile'
    return axios({
        url: url,
        method: 'post',
        data: formData,
        headers: {
            'Content-Type':'multipart/form-data'
          },
    })
}

/**
 * 获取公司列表
 * @param {*} paramIo 
 */
export function getCompanyList(paramIo) {
    let finalUrl = joinPramas('/api/backend/company/list', paramIo)
    return axios({
        url: finalUrl,
        method: 'get'
    })
}


/**
 * 新增公司
 * @param {*} paramIo 
 */
export function addCompany(paramIo) {
    return axios({
        url: '/api/backend/company/add',
        method: 'post',
        data: paramIo
    })
}

/**
 * 修改公司
 * @param {*} paramIo 
 */
export function updateCompany(id, paramIo) {
    paramIo.id = id
    return axios({
        url: '/api/backend/company/edit',
        method: 'post',
        data: paramIo
    })
}

/**
 * 逻辑删除公司
 * @param {*} paramIo 
 */
export function deleteCompany(id) {
    return axios({
        url: '/api/backend/company/delete/' + id,
        method: 'post'
    })
}
/**
 * 根据角色id或者管理员列表
 * @param {*} paramIo 
 */
export function getUserByRole(id) {
    return axios({
      url: '/api/sys/user/listUserByRole/'+id,
      method: 'get'
    })
}
